#pragma once
#include <game/Config.h>
#include <game/flow/TriggerFactory.h>
#include <game/flow/FlowAdjuster.h>
#include <memory>

#include <xml/Object.h>
#include <AutoContainer.h>
#include <vector>

ARELLO_GAME_NAMESPACE_DECL_START
namespace flow {
class Trigger;
class Manager;
class EntryDefinition;
class EntryExitDefinition;

class TriggerEntry
	: private xml::ObjectANSI
	, private FlowAdjuster
{
public:
	TriggerEntry(Manager& flowManager);
	~TriggerEntry();

	xml::ObjectANSI* GetLoader() { return this; }
	virtual void ScreenChanging(EntryDefinition* newEntry);
private: // xml::ObjectANSI
	virtual bool on_attribute(xml::Provider * prov, const std::string & name, const std::string & value);
	virtual bool on_node(xml::Provider * prov, const std::string & name);
private: // FlowAdjuster
	virtual void PushFront(const std::string& exitId);
private:
	Manager& flowManager;

	Trigger* getTrigger();
	std::auto_ptr<Trigger> trigger;
	std::string triggerName;
	AutoContainer<std::vector<EntryExitDefinition*> > exits;
};

} // namespace flow
ARELLO_GAME_NAMESPACE_DECL_END